﻿// MainDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "学生管理系统MFC.h"
#include "MainDlg.h"
#include "afxdialogex.h"


// MainDlg 对话框

IMPLEMENT_DYNAMIC(CMainDlg, CDialog)

CMainDlg::CMainDlg(CWnd* pParent /*=NULL*/)
	: CDialog(IDD_MAINDLG, pParent)
{

}

CMainDlg::~CMainDlg()
{
}

void CMainDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_MAINTAB, m_maintab);
}


BEGIN_MESSAGE_MAP(CMainDlg, CDialog)
	ON_NOTIFY(TCN_SELCHANGE, IDC_MAINTAB, &CMainDlg::OnTcnSelchangeMaintab)
END_MESSAGE_MAP()


// MainDlg 消息处理程序


void CMainDlg::OnTcnSelchangeMaintab(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: 在此添加控件通知处理程序代码
	int m_CurSelTab = m_maintab.GetCurSel();

	// TODO: Add your control notification handler code here
	if (m_CurSelTab == 0)
	{
		m_lessontable.ShowWindow(SW_SHOW);
		m_selectlesson.ShowWindow(SW_HIDE);
		m_grade.ShowWindow(SW_HIDE);
		m_estimate.ShowWindow(SW_HIDE);
		m_fee.ShowWindow(SW_HIDE);
		m_info.ShowWindow(SW_HIDE);
	}
	else if (m_CurSelTab == 1)
	{
		m_lessontable.ShowWindow(SW_HIDE);
		m_selectlesson.ShowWindow(SW_SHOW);
		m_grade.ShowWindow(SW_HIDE);
		m_estimate.ShowWindow(SW_HIDE);
		m_fee.ShowWindow(SW_HIDE);
		m_info.ShowWindow(SW_HIDE);
	}
	else if (m_CurSelTab == 2)
	{
		m_lessontable.ShowWindow(SW_HIDE);
		m_selectlesson.ShowWindow(SW_HIDE);
		m_grade.ShowWindow(SW_SHOW);
		m_estimate.ShowWindow(SW_HIDE);
		m_fee.ShowWindow(SW_HIDE);
		m_info.ShowWindow(SW_HIDE);
	}
	else if (m_CurSelTab == 3)
	{
		m_lessontable.ShowWindow(SW_HIDE);
		m_selectlesson.ShowWindow(SW_HIDE);
		m_grade.ShowWindow(SW_HIDE);
		m_estimate.ShowWindow(SW_SHOW);
		m_fee.ShowWindow(SW_HIDE);
		m_info.ShowWindow(SW_HIDE);
	}
	else if (m_CurSelTab == 4)
	{
		m_lessontable.ShowWindow(SW_HIDE);
		m_selectlesson.ShowWindow(SW_HIDE);
		m_grade.ShowWindow(SW_HIDE);
		m_estimate.ShowWindow(SW_HIDE);
		m_fee.ShowWindow(SW_SHOW);
		m_info.ShowWindow(SW_HIDE);
	}
	else if (m_CurSelTab == 5)
	{
		m_lessontable.ShowWindow(SW_HIDE);
		m_selectlesson.ShowWindow(SW_HIDE);
		m_grade.ShowWindow(SW_HIDE);
		m_estimate.ShowWindow(SW_HIDE);
		m_fee.ShowWindow(SW_HIDE);
		m_info.ShowWindow(SW_SHOW);
	}
	m_CurSelTab = 1 - m_CurSelTab;
	*pResult = 0;
}


BOOL CMainDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	m_maintab.InsertItem(0, _T("课程表"));
	m_maintab.InsertItem(1, _T("选课"));
	m_maintab.InsertItem(2, _T("成绩"));
	m_maintab.InsertItem(3, _T("评估"));
	m_maintab.InsertItem(4, _T("学分学费"));
	m_maintab.InsertItem(5, _T("个人信息"));
	m_maintab.SetCurSel(0);//设置默认选项卡  
	m_lessontable.Create(IDD_LESSONTABLE, &m_maintab);
	m_selectlesson.Create(IDD_SELECTLESSON, &m_maintab);
	m_grade.Create(IDD_GRADE, &m_maintab);
	m_estimate.Create(IDD_ESTIMATEDLG, &m_maintab);
	m_fee.Create(IDD_FEE, &m_maintab);
	m_info.Create(IDD_INFORMATION, &m_maintab);
	//设定在Tab内显示的范围
	CRect rc;
	m_maintab.GetClientRect(rc);
	rc.top += 20;
	rc.bottom -= 0;
	rc.left += 0;
	rc.right -= 0;
	m_lessontable.MoveWindow(&rc);
	m_selectlesson.MoveWindow(&rc);
	m_grade.MoveWindow(&rc);
	m_estimate.MoveWindow(&rc);
	m_fee.MoveWindow(&rc);
	m_info.MoveWindow(&rc);
	//显示初始页面
	m_lessontable.ShowWindow(SW_SHOW);
	m_selectlesson.ShowWindow(SW_HIDE);
	m_grade.ShowWindow(SW_HIDE);
	m_estimate.ShowWindow(SW_HIDE);
	m_fee.ShowWindow(SW_HIDE);
	m_info.ShowWindow(SW_HIDE);
	// TODO:  在此添加额外的初始化

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}
void CMainDlg::OnOK()
{

}